
//
//  HWGoOutTableViewCell.m
//  HappyWeekend
//
//  Created by 赵洁 on 16/1/12.
//  Copyright © 2016年 com.mjykj.www. All rights reserved.
//

#import "HWGoOutTableViewCell.h"
#import "HWChannelsModel.h"
#define kgap 10 //jianju
@implementation HWGoOutTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _titleLable = [[UILabel alloc]initWithFrame:CGRectMake(kgap, kgap, kgap*5, kgap*3)];
        _titleLable.font = [UIFont systemFontOfSize:15];
        _titleLable.text = @"出门";
        [self.contentView addSubview:_titleLable];
        
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 4; j++) {
                UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
                button.frame = CGRectMake(kgap + j *(kScreenWidth/5+kgap*2),_titleLable.bottom+kgap+i*130 , kScreenWidth/5-kgap,kScreenWidth/5-kgap);
                button.layer.cornerRadius = (kScreenWidth/5)/2;
               // button.backgroundColor = [UIColor blackColor];
                button.tag = 1+j+i*4;
                UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake((kgap*1.8)+j*(kScreenWidth/5+kgap*2), button.bottom+kgap+i*10, kScreenWidth/4.4, kgap*3)];
                //lable.backgroundColor = [UIColor grayColor];
                lable.tag = 20+j+i*4;
                [self.contentView addSubview:lable];
                [self.contentView addSubview:button];
                

            }
        }
        
        _weekendButton = [self.contentView viewWithTag:1];
        _experienceButton = [self.contentView viewWithTag:2];
        _rimButton = [self.contentView viewWithTag:3];
        _tasteFoodButton = [self.contentView viewWithTag:4];
        _barButton = [self.contentView viewWithTag:5];
        _freeButton = [self.contentView viewWithTag:6];
        
    }
    return self;
    
}

- (void)setOutArray:(NSArray *)outArray
{
    _outArray = outArray;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 4; j++) {
            if (i == 1 && j > 1) {
                break;
            }
            HWChannelsModel *model = outArray[i * 4 + j];
            UIButton *but = [self.contentView viewWithTag:1+j+i*4];
            [but sd_setBackgroundImageWithURL:[NSURL URLWithString:model.icon_url] forState:(UIControlStateNormal)];
            UILabel *lable = [self.contentView viewWithTag:20+j+i*4];
            lable.text = model.name;
        }
    }
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
